<?php
@require("../class/connect.php");
if(!defined('InEmpireCMS'))
{
	exit();
}
include("../class/db_sql.php");
include("../class/config.php");
include("../class/q_functions.php");
include("../class/class.php");
include LoadLang("pub/fun.php");
$link=db_connect();
$empire=new mysqlquery();
//用户名
$lusername=getcvar('mlusername');
if($lusername)
{$lpassword=md5($lusername);}
$id=(int)$_GET['id'];
$classid=(int)$_GET['classid'];
if(empty($id)||empty($classid))
{printerror("ErrorUrl","history.go(-1)",1);}
if(empty($class_r[$classid][tbname]))
{
	printerror("ErrorUrl","history.go(-1)",1);
}
$n_r=$empire->fetch1("select id,title,newspath,filename,classid,groupid,plnum,infopfen,infopfennum from {$dbtbpre}ecms_".$class_r[$classid][tbname]." where id='$id' and classid='$classid'");
if(empty($n_r[id]))
{printerror("ErrorUrl","history.go(-1)",1);}
$page=(int)$_GET['page'];
$start=(int)$_GET['start'];
$search="&classid=$classid&id=".$id;
$page_line=12;//每页显示链接数
$line=20;//每页显示记录数
$offset=$start+$page*$line;//总偏移量
$query="select plid,saytext,saytime,sayip,username,zcnum,fdnum,userid from {$dbtbpre}enewspl where id='$id' and classid='$classid' and checked=0";
//需审核
if($class_r[$classid][checkpl])
{
	$totalquery="select count(*) as total from {$dbtbpre}enewspl where id='$id' and classid='$classid' and checked=0";
	$num=$empire->gettotal($totalquery);
}
else
{
	$num=$n_r['plnum'];
}
$query.=" order by plid desc limit $offset,$line";
$sql=$empire->query($query);
$listpage=page1($num,$line,$page_line,$start,$page,$search);
//标题链接
$titleurl=sys_ReturnBqTitleLink($n_r);
$title=$n_r[title];
//评分
$infopfennum=$n_r['infopfennum'];
$pinfopfen=$infopfennum?round($n_r['infopfen']/$infopfennum):0;
$url=ReturnClassLink($n_r[classid])."&nbsp;>&nbsp;<a href=".$titleurl.">".$n_r[title]."</a>&nbsp;>&nbsp;".$fun_r[pl];
?>
<!--empire.listtemp.top-->
<?
while($r=$empire->fetch($sql))
{
	if(empty($r[username]))
	{$r[username]=$fun_r['nomember'];}
	if($r[userid])
	{
		$r[username]="<a href='$public_r[newsurl]e/space?userid=$r[userid]' target='_blank'>$r[username]</a>";
	}
	$r['saytext']=stripSlashes($r['saytext']);
	//替换表情
	$r['saytext']=RepPltextFace($r['saytext']);
	//ip
	$ipr=explode(".",$r[sayip]);
	$r[sayip]="";
	$ipnum=count($ipr);
	for($i=0;$i<$ipnum;$i++)
	{
		if($i!=0)
		{$d=".";}
		if($i==$ipnum-1)
		{
			$ipr[$i]="*";
		}
		$r[sayip].=$d.$ipr[$i];
	}
	$includelink=" onclick=\"javascript:document.saypl.saytext.value+='[quote]".$r[plid]."[/quote]';document.saypl.repid.value='".$r[plid]."';document.saypl.saytext.focus();\"";
?>
<!--empire.listtemp.center-->
<?
}
db_close();
$empire=null;
?>
<!--empire.listtemp.footer-->
